package com.yuntongxun.ecdemo.rest.interfaces;

import com.yuntongxun.ecdemo.rest.models.ServerResult;
import com.yuntongxun.ecdemo.rest.models.UserAccountModel;
import com.yuntongxun.ecdemo.rest.models.UserModel;

import retrofit.Callback;
import retrofit.http.DELETE;
import retrofit.http.Field;
import retrofit.http.FormUrlEncoded;
import retrofit.http.GET;
import retrofit.http.POST;
import retrofit.http.Path;
import retrofit.http.Query;

/**
 * Created by hankers on 16/7/25.
 */
public interface UserInterface {
    @GET("/api/users")
    void search(@Query("search") String search, @Query("pageindex") int pageindex, Callback<UserModel[]> callback);
    @GET("/api/users/{account}/contacts")
    void getContacts(@Path("account") String account, Callback<UserModel[]> callback);
    @FormUrlEncoded
    @POST("/api/users/{account}/requestfriend")
    void requestFriend(@Path("account") String account, @Field("receiver") String friendAccount, @Field("message") String message, Callback<ServerResult> callback);
    @FormUrlEncoded
    @POST("/api/users/{account}/confirmfriend")
    void confirmFriend(@Path("account") String account, @Field("receiver") String friendAccount, Callback<ServerResult> callback);
    @DELETE("/api/users/{account}/contacts/{friendAccount}")
    void deleteContact(@Path("account") String account, @Path("friendAccount") String friendAccount, Callback<ServerResult> callback);
    @FormUrlEncoded
    @POST("/api/users")
    void register(@Field("phone") String phone, @Field("VerificationCode") String verificationCode,  @Field("name") String name,  @Field("Password") String password, Callback<UserAccountModel> callback);
    @GET("/api/captcha")
    void sendVerificationCode(@Query("phone") String phone, @Query("checkexists") int checkExists, Callback<ServerResult> callback);
}
